package lc {
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    import mx.controls.Image;
    import mx.controls.TileList;
    import mx.controls.listClasses.IListItemRenderer;
    import mx.managers.PopUpManager;


    public class TileListEx extends TileList {
        private var img:Image = new Image();
        private var flag:Boolean = false;

        override protected function drawSelectionIndicator(indicator:Sprite, x:Number,
            y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {
            var g:Graphics = Sprite(indicator).graphics;
            g.clear();
            g.beginFill(color, 0.6);
            //g.drawCircle(width / 2, width / 2, width / 2);
            g.drawEllipse(0, 0, width, height);
            g.endFill();
            indicator.x = x;
            indicator.y = y;
        }
        
        override protected function drawHighlightIndicator(indicator:Sprite, x:Number,
            y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {
            var g:Graphics = Sprite(indicator).graphics;
            g.clear();
            g.beginFill(color, 0.6);
            //g.drawCircle(width / 2, width / 2, width / 2);
            g.drawEllipse(0, 0, width, height);
            g.endFill();
            indicator.x = x;
            indicator.y = y;
        }        
        /*********below is only for the image in XML files
        override protected function mouseOverHandler(event:MouseEvent):void {

            if (event.type == "mouseOver" && !flag) {
                img.source = mouseEventToItemRenderer(event).data.@source;
                PopUpManager.addPopUp(img, this, false);
                img.move(event.stageX + 5, event.stageY - 250);
                //img.move(0,100);
                flag = true;
            }

        }

        override protected function mouseOutHandler(event:MouseEvent):void {
            if (flag) {
                PopUpManager.removePopUp(img);
                flag = false;
            }
        }
        */
    }
}